package com.springboot.demo.controller;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.springboot.demo.entity.CentralMonitor;
import com.springboot.demo.entity.SceneGraph;
import com.springboot.demo.entity.User;
import com.springboot.demo.entity.UserDetailsImpl;
import com.springboot.demo.entity.validate.user.IdGroup;
import com.springboot.demo.service.CentralMonitorService;
import com.springboot.demo.utils.ResponseUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.web.JsonPath;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import javax.validation.groups.Default;
import java.util.List;

/**
 * @author wubc683
 * @desc
 * @date 2021-11-26 11:54
 */
//@RestController
//@Api(tags = "集中监控接口")
//@Slf4j
//public class CentralMonitorController {
//    @Autowired
//    ResponseUtils responseUtils;
//    @Autowired
//    CentralMonitorService centralMonitorService;
//
//    @GetMapping("/central/monitor/all")
//    @ApiOperation(value = "获取集中监控所有分组信息")
//    @ApiOperationSupport(order = 90)
//    public ResponseUtils<List<CentralMonitor>> getAllCentralMonitor() {
//        Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
//        UserDetailsImpl userDetailsImpl = (UserDetailsImpl) principal;
//        User implUser = userDetailsImpl.getUser();
//        List<CentralMonitor> allCentralMonitor = centralMonitorService.getAllCentralMonitor(implUser.getId());
//        return responseUtils.buildSuccessResponse(allCentralMonitor);
//    }
//
//    @PostMapping("/central/monitor/name/{name}")
//    @ApiOperation(value = "创建集中监控分组", notes = "最多10个")
//    @ApiOperationSupport(order = 100)
//    public ResponseUtils saveCentralMonitor(@PathVariable("name") String name) {
//        Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
//        UserDetailsImpl userDetailsImpl = (UserDetailsImpl) principal;
//        User implUser = userDetailsImpl.getUser();
//        centralMonitorService.saveCentralMonitor(implUser.getId(),name.trim());
//        return responseUtils.buildSuccessResponse();
//    }
//
//    @PutMapping("/central/monitor/{cid}/name/{name}")
//    @ApiOperation(value = "修改集中监控分组")
//    @ApiOperationSupport(order = 110)
//    public ResponseUtils updateCentralMonitor(@PathVariable("cid") Long cid,@PathVariable("name") String name) {
//        Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
//        UserDetailsImpl userDetailsImpl = (UserDetailsImpl) principal;
//        User implUser = userDetailsImpl.getUser();
//        centralMonitorService.updateCentralMonitor(implUser.getId(),cid,name.trim());
//        return responseUtils.buildSuccessResponse();
//    }
//
//    @DeleteMapping("/central/monitor/{cid}")
//    @ApiOperation(value = "删除集中监控分组")
//    @ApiOperationSupport(order = 120)
//    public ResponseUtils deleteCentralMonitor(@PathVariable("cid") Long cid) {
//        Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
//        UserDetailsImpl userDetailsImpl = (UserDetailsImpl) principal;
//        User implUser = userDetailsImpl.getUser();
//        centralMonitorService.deleteCentralMonitor(implUser.getId(),cid);
//        return responseUtils.buildSuccessResponse();
//    }
//
//    @GetMapping("/central/monitor/{cid}/state/{state}")
//    @ApiOperation(value = "获取集中监控分组所有场景组态缩略图")
//    @ApiOperationSupport(order = 130)
//    public ResponseUtils<SceneGraph> getCentralMonitorSceneGraph(
//            @PathVariable("cid") Long cid,
//            @PathVariable("state") @ApiParam("场景状态：0未发布，1未运行，2运行正常，3设备离线，4产生报警") Integer state) {
//        Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
//        UserDetailsImpl userDetailsImpl = (UserDetailsImpl) principal;
//        User implUser = userDetailsImpl.getUser();
////        centralMonitorService.
//        return responseUtils.buildSuccessResponse();
//    }
//
//    @PostMapping("/central/monitor/{cid}/scene/{sid}")
//    @ApiOperation(value = "增加集中监控分组场景组态缩略图", notes = "最多100个")
//    @ApiOperationSupport(order = 140)
//    public ResponseUtils saveCentralMonitorSceneGraph(
//            @PathVariable("cid") @ApiParam(value = "监控分组id", required = true) Long cid,
//            @PathVariable("sid") @ApiParam(value = "场景id", required = true) Long sid
//    ) {
//        Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
//        UserDetailsImpl userDetailsImpl = (UserDetailsImpl) principal;
//        User implUser = userDetailsImpl.getUser();
//        return responseUtils.buildSuccessResponse();
//    }
//
//    @DeleteMapping("/central/monitor/{cid}/scene/{sid}")
//    @ApiOperation(value = "删除集中监控分组场景组态缩略图")
//    @ApiOperationSupport(order = 150)
//    public ResponseUtils deleteCentralMonitorSceneGraph(
//            @PathVariable("cid") @ApiParam(value = "监控分组id", required = true) Long cid,
//            @PathVariable("sid") @ApiParam(value = "场景id", required = true) Long sid
//    ) {
//        Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
//        UserDetailsImpl userDetailsImpl = (UserDetailsImpl) principal;
//        User implUser = userDetailsImpl.getUser();
//        return responseUtils.buildSuccessResponse();
//    }
//}


